package com.littlerpc.common.util;

/**
 * Created by ChengPeng on 2017/6/25.
 */

import java.lang.annotation.Annotation;

public class ScanClassTest/* extends TestCase*/{
    private ClassFilter filter;

    protected void setUp(){
        filter = new ClassFilter(){
            @Override
            public boolean accept(Class clazz) {
                Annotation[] annotations = clazz.getAnnotations();
                return annotations.length >10;
                       /* !Modifier.isAbstract(clazz.getModifiers())
                                && !Modifier.isInterface(clazz.getModifiers())
                                && Modifier.isPublic(clazz.getModifiers())
                                && !Modifier.isStatic(clazz.getModifiers());*//*
                                && A.class.isAssignableFrom(clazz);*/
            }
        };
    }
    public void testScanClassTest() throws Exception{

        for(Class clazz : LauncherScanUtil.scanPackages(new String[]{"org.apache.zookeeper"},filter)){
            System.out.println(clazz);
        }

    }

    public static void main(String[] args){

        ClassFilter filter = new ClassFilter() {
            @Override
            public boolean accept(Class clazz) {
                return true;
            }
        };

        for(Class clazz : LauncherScanUtil.scanPackages(new String[]{"org.apache.zookeeper"},filter)){
            System.out.println(clazz);
        }

    }
}